package org.onion.pattern.sample.order.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class ExceptionsHandler {

    @ExceptionHandler(Throwable.class)
    @ResponseStatus(HttpStatus.SERVICE_UNAVAILABLE)
    private String warnHandle(Throwable ex) {
        log.error("", ex);
        return ex.getMessage();
    }


}
